using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;

namespace GameEngine
{
    public class TwoPointObject : ThreeStateObject
    {
        public Vector2 StartPosition;
        public Vector2 EndPosition;
        public Vector2 Position;
        
        public TwoPointObject(Game game)
            : base(game)
        {

        }

        public override void Initialize()
        {
            StartPosition = new Vector2(-800, -800);
            EndPosition = new Vector2(-800, -800);
            Position = new Vector2(-800, -800);

            base.Initialize();
        }

        public override void BeginAnimation(float ratio)
        {
            Position.X = StartPosition.X + ratio * (EndPosition.X - StartPosition.X);
            Position.Y = StartPosition.Y + ratio * (EndPosition.Y - StartPosition.Y);

            base.BeginAnimation(ratio);
        }

        public override void EndBeginAnimation()
        {
            Position = EndPosition;
            base.EndBeginAnimation();
        }

        public override void EndAnimation(float ratio)
        {
            Position.X = EndPosition.X - ratio * (EndPosition.X - StartPosition.X);
            Position.Y = EndPosition.Y - ratio * (EndPosition.Y - StartPosition.Y);

            base.EndAnimation(ratio);
        }
    }
}
